package com.bigger.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bigger.entity.Employee;
import com.bigger.vo.WagesVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface EmployeeMapper extends BaseMapper<Employee> {
    @Select("select * from employee where username = #{username};")
    Employee selectByUsername(String username);
    @Select("select e.name as empl_name,e.phone as empl_phone,count(o.id) as total_order,sum(o.price) as total_wages from employee e,`order` o " +
            "where o.employee_id=e.id and o.finish_time between #{start} and #{end} and o.status=#{status} " +
            "group by e.id")
    List<WagesVO> wages(LocalDateTime start, LocalDateTime end,Integer status);
}
